class CreateCustomerAddresses < ActiveRecord::Migration
  def self.up
    create_table :customer_addresses do |t|
      t.string :address    ,:limit => 80
      t.integer :customer_id
      #t.references :customer
      #t.belongs_to :customer
      t.integer :is_locked ,:limit => 1 ,:default => 0 #是否管理会要锁定 1为True 0为False
      t.timestamps
    end
    
    CustomerAddress.create(:address => '青岛市四方区初始化地址',:customer_id => '3')
    CustomerAddress.create(:address => '青岛市李沧区初始化地址',:customer_id => '4')
    CustomerAddress.create(:address => '青岛市市南区初始化地址',:customer_id => '5')
    CustomerAddress.create(:address => '青岛市市北区初始化地址',:customer_id => '2')
  end
  
  def self.down
    drop_table :customer_addresses
  end
end
